package com.lanou.connotationjoke.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

import com.lanou.connotationjoke.R;

/**
 * Created by dllo on 16/1/19.
 */
public class WebViewActivity extends BaseActivity {
    static String url;
    private WebView webView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_webview);
        webView = (WebView) findViewById(R.id.webview);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String
                    url) {
                view.loadUrl(url); // 根据传入的参数再去加载新的网页
                return true; // 表示当前WebView可以处理打开新网页的请求，不用借助
                //系统浏览器
            }

        });
        webView.loadUrl(url);
    }

    public static void goToWebViewActivity(Context context, String s) {
        url = s;
        Intent intent = new Intent(context, WebViewActivity.class);
        context.startActivity(intent);
    }

}
